# encoding: utf-8
# Datetime  : 2020/6/2 7:52 PM
# User      : zzz
# File      : proxy_util.py
import json

import requests


def get_proxy():
    proxy = requests.get("http://127.0.0.1:5010/get/").json().get("proxy")
    return {"http": "http://{}".format(proxy)}


def get_bl_proxy():
    proxies = json.loads(requests.get('http://proxy-service.bailian-ai.com/random').text)
    proxies.pop('https')
    print(f"proxy info :{proxies}")
    return proxies

def delete_proxy(proxy):
    requests.get("http://127.0.0.1:5010/delete/?proxy={}".format(proxy))


if __name__ == '__main__':
    print(get_proxy())
